﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/MasterAdmin.master" AutoEventWireup="true"
    CodeFile="ListProduct.aspx.cs" Inherits="Admin_ListProduct" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1>
        List Products
    </h1>
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
        onitemdatabound="ListView1_ItemDataBound">
        <AlternatingItemTemplate>
            <tr style="background-color: #FFFFFF;color: #284775;">
            <td>
                    <a href='<%# Eval("pProductCode","UpdateProduct.aspx?pCode={0}") %>'>Select</a>
                </td>
                <td>
                    <asp:Label ID="pProductCodeLabel" runat="server" 
                        Text='<%# Eval("pProductCode") %>' />
                        
                </td>
                <td>
                    <asp:Label ID="pNameLabel" runat="server" Text='<%# Eval("pName") %>' />
                </td>
                <td>
                    <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("pSmallImage","~/ImageProduct/{0}") %>' Height="100px" Width="100px">
                   </asp:Image>
                </td>
                <td>
                <asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("pBigImage","~/ImageProduct/{0}") %>' Height="100px" Width="100px">
                   </asp:Image>
                    
                </td>
                <td>
                    <asp:Label ID="pDescriptionLabel" runat="server" 
                        Text='<%# Eval("pDescription") %>' />
                </td>
                <td>
                    <asp:Label ID="pCategoryIdLabel" runat="server" 
                        Text='<%# Eval("pCategoryId") %>' />
                </td>
                <td>
                    <asp:Label ID="pPriceLabel" runat="server" Text='<%# Eval("pPrice") %>' />
                </td>
                <td>
                    <asp:CheckBox ID="pActiveCheckBox" runat="server" 
                        Checked='<%# Eval("pActive") %>' Enabled="false" />
                </td>
                <td>
                    <asp:Label ID="pQuantityLabel" runat="server" Text='<%# Eval("pQuantity") %>' />
                </td>
            </tr>
        </AlternatingItemTemplate>
  
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
  
        <ItemTemplate>
            <tr style="background-color: #E0FFFF;color: #333333;">
                <td>
                    <a href='<%# Eval("pProductCode","UpdateProduct.aspx?pCode={0}") %>'>Select</a>
                </td>
                <td>
                    <asp:Label ID="pProductCodeLabel" runat="server" 
                        Text='<%# Eval("pProductCode") %>' />
                </td>
                <td>
                    <asp:Label ID="pNameLabel" runat="server" Text='<%# Eval("pName") %>' />
                </td>
                <td>
                   <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("pSmallImage","~/ImageProduct/{0}") %>' Height="100px" Width="100px">
                   </asp:Image>
                </td>
                <td>
                    <asp:Image ID="Image2" runat="server" ImageUrl='<%# Eval("pBigImage","~/ImageProduct/{0}") %>' Height="100px" Width="100px">
                   </asp:Image>
                </td>
                <td>
                    <asp:Label ID="pDescriptionLabel" runat="server" 
                        Text='<%# Eval("pDescription") %>' />
                </td>
                <td>
                    <asp:Label ID="pCategoryIdLabel" runat="server" 
                        Text='<%# Eval("pCategoryId") %>' />
                </td>
                <td>
                    <asp:Label ID="pPriceLabel" runat="server" Text='<%# Eval("pPrice") %>' />
                </td>
                <td>
                    <asp:CheckBox ID="pActiveCheckBox" runat="server" 
                        Checked='<%# Eval("pActive") %>' Enabled="false" />
                </td>
                <td>
                    <asp:Label ID="pQuantityLabel" runat="server" Text='<%# Eval("pQuantity") %>' />
                </td>
            </tr>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr runat="server" style="background-color: #E0FFFF;color: #333333;">
                           <th runat="server">
                                    Select Update</th>
                                <th runat="server">
                                    ProductCode</th>
                                <th runat="server">
                                    Name</th>
                                <th runat="server">
                                    SmallImage</th>
                                <th runat="server">
                                    BigImage</th>
                                <th runat="server">
                                    Description</th>
                                <th runat="server">
                                    CategoryId</th>
                                <th runat="server">
                                    Price</th>
                                <th runat="server">
                                    Active</th>
                                <th runat="server">
                                    Quantity</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowLastPageButton="True" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
  
       
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>" 
        SelectCommand="SELECT [pProductCode], [pName], [pSmallImage], [pBigImage], [pDescription], [pCategoryId], [pPrice], [pActive], [pQuantity] FROM [Products]"></asp:SqlDataSource>
    <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" />
</asp:Content>
